package com.aiti.lulian.controller;

import com.aiti.base.core.base.controller.WebController;
import com.aiti.base.core.base.vo.SysUserHeaderVo;
import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.bo.CardAccessRecordBo;
import com.aiti.lulian.service.ICardAccessRecordService;
import com.aiti.lulian.vo.CardAccessRecordVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据概览
 */
@RestController
@RequestMapping("access_record")
@RequiredArgsConstructor
public class CardAccessRecordController extends WebController {

    private final ICardAccessRecordService cardAccessRecordService;

    /**
     * 通过企业Id获取访问数量
     * @return
     */
    @GetMapping("/getCardAccessCount")
    public Message getCardAccessCountByEnterpriseId(CardAccessRecordBo bo){
        if(StringUtils.isBlank(bo.getRoleIds())){
            return Message.fail("没有找到用户的角色");
        }
        String userId = findUserId();
        return cardAccessRecordService.getCardAccessCountByEnterpriseId(userId,bo);
    }
}
